#pragma once
#include "SocketStream.h"

#define MSG_HEADER_SIZE 8

class Msg
{
public:
	Msg() {m_nRefCount = 0;}
	virtual ~Msg(){};
	virtual DWORD GetMsgId() = 0;
	virtual DWORD GetLength() {return 0;};
	virtual BOOL Read(CSocketStream& iStream){ return TRUE;} ;
	virtual BOOL Write(CSocketStream& oStream) const {return TRUE;};

	void AddRef() {m_nRefCount++;};
	void ReleaseRef() {m_nRefCount--;};
	BOOL IsReference() { return m_nRefCount > 0;};
public:
	int m_nRefCount;
};